package com.zuikaku;

import com.aliyuncs.DefaultAcsClient;
import com.aliyuncs.IAcsClient;
import com.aliyuncs.profile.DefaultProfile;
import com.zuikaku.job.DetectIpChange;


import java.util.ResourceBundle;

public class AppRun {

    public static void main(String[] args){
        // 1:读取配置文件，
        ResourceBundle rb =ResourceBundle.getBundle("config");
        String aliyunAccessKey= rb.getString("aliyun.accessKey");
        String aliyunSecretKey=rb.getString("aliyun.secretKey");
        String domainName = rb.getString("aliyun.domainName");
        int periodTime = Integer.parseInt(rb.getString("ddns.periodTime"));
        // 2:构建aliyun的client对象
        DefaultProfile profile = DefaultProfile.getProfile("cn-hangzhou",// 地域ID
                aliyunAccessKey,// 您的AccessKey ID
                aliyunSecretKey);// 您的AccessKey Secret
        IAcsClient client = new DefaultAcsClient(profile);
        //3:开启线程
        DetectIpChange detectIpChange =new DetectIpChange();
        detectIpChange.setDomain(domainName);
        detectIpChange.setAliyunClient(client);
        detectIpChange.setPeriodTime(periodTime);
        Thread t =new Thread(detectIpChange);
        t.start();
    }
}
